<?php
//广告设置
include 'islogin.php';
include '../config.php';

	if(isset($_POST['hid']))
	{
		
			if($_POST['hid']=="bigurl")
			{				for($i = 1; $i <= 5; $i++){					$sql = "update trunimg set url='".$_POST['bigurl'.$i]."' where orders={$i}";					mysql_query($sql);				}								exit("<script>alert('修改成功');location.href='puset.php';</script>");
			}						if($_POST['hid']=="bigur2")			{				for($i = 11; $i <= 15; $i++){					$sql = "update trunimg set url='".$_POST['bigur2'.$i]."' where orders={$i}";					mysql_query($sql);				}								exit("<script>alert('修改成功');location.href='puset.php';</script>");			}
	}
?>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<link href="css/right.css" rel="stylesheet" type="text/css"/>
<script src="../js/jquery-1.7.1.js"></script>
<link href="js/upload/uploadify.css" rel="stylesheet" type="text/css" />
<script src="js/upload/swfobject.js"></script>
<script src="js/upload/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript">
   $(document).ready(function(){

	   $('.upinput').uploadify({
		   'uploader':'js/upload/uploadify.swf',
		   'cancelImg':'js/upload/cancel.png',
		   'fileExt':'*.png',
		   'script':'uploadify.php',
		   'auto':false,
		   'folder':'upload',
		   'buttonImg':'../admin/images/uploadbtn.png',
		   'wmode':'transparent',
		   'onComplete':function(event,queueId,fileObj,response,data){
			     alert("修改成功");
			   }
		   });
	   });

   function uploads(id)
   {
	   $('#uphdp'+id).uploadifySettings('scriptData',{'id':id});

	   $('#uphdp'+id).uploadifyUpload();
   }

   function save(tar)
   {
	   	if(tar=='bigurl')
	   	{
		    document.bigurl_form.submit();
	   	}
   }
</script>


<div style="border:0px solid red;"> 

    	<div id="top"><div>广告设置</div></div>
    	
	    <div id="middle">
	    		<!-- 大幻灯片图片 -->
	    		 <div class="layout" >
	       			<div class="title">首页大幻灯片图片</div>
	       			<div class="content">
			           <table>
				             <tr>
				   		   		<td class="title_td">幻灯片1图片：</td>
				                <td><input class="upinput" id="uphdp1" /></td>
				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('1')"/></td>
			   				</tr>
			   				<tr>
				   		   		<td class="title_td">幻灯片2图片：</td>
				                <td ><input class="upinput" id="uphdp2" /></td>
				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('2')"/></td>
			   				</tr>
			   		
			   				<tr>
				   		   		<td class="title_td"> 幻灯片3图片：</td>
				                <td><input class="upinput" id="uphdp3"/></td>
				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('3')"/></td>
			   				</tr>
			   		
			   				<tr>
				   		   		<td class="title_td">幻灯片4图片：</td>
				                <td><input class="upinput" id="uphdp4" /></td>
				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('4')"/></td>
			   				</tr>
			   				
			   				<tr>
				   		   		<td class="title_td">幻灯片5图片：</td>
				                <td ><input class="upinput" id="uphdp5" /></td>
				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('5')"/></td>
			   				</tr>
			   				<tr><td class="title_td" colspan="3" >注:请上传960*365大小的jpg,png,gif类型图片</td></tr>
			           </table>
	       			</div>
	       		  </div>	
	       		<!-- 大幻灯片链接 -->
	       			<?php 
	       			$sql="select id,type,url,path,orders from trunimg where type = 1 order by orders";
	       			$result = mysql_query($sql);
	       			
	       			?>
	       		   <div class="layout" >
	       			<div class="title">首页大幻灯片链接</div>
	       			<div class="content">
	       			<form id="bigurl_form" method="post" action="puset.php" >
			           <table>
			              <?php 
			                  while($row = mysql_fetch_array($result))
			                  	{
			                  		echo "<tr><td class='title_td'>幻灯片".$row['orders']."链接：</td>";
			                  		echo" <td><input name='bigurl".$row['orders']."' value=".$row['url']." /></td>";
			                  		echo"</tr>";
			                  	}
			              ?>
			              <tr>
			              	 <td class="title_td"></td>
			   				 <td><input type="submit" value="保存"  /></td>
			   				 <td class="remark_td"><input name="hid" type="hidden" value="bigurl" /></td>
			              </tr>
			           	</table>
			           </form>
	       			</div>
	       		  </div>	
	       			
	    </div>	    	    	    <div id="middle">	    		<!-- 大幻灯片图片 -->	    		 <div class="layout" >	       			<div class="title">热门产品展示</div>	       			<div class="content">			           <table>				             <tr>				   		   		<td class="title_td">产品1图片：</td>				                <td><input class="upinput" id="uphdp6" /></td>				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('6')"/></td>			   				</tr>			   				<tr>				   		   		<td class="title_td">产品2图片：</td>				                <td ><input class="upinput" id="uphdp7" /></td>				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('7')"/></td>			   				</tr>			   					   				<tr>				   		   		<td class="title_td"> 产品3图片：</td>				                <td><input class="upinput" id="uphdp8"/></td>				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('8')"/></td>			   				</tr>			   					   				<tr>				   		   		<td class="title_td">产品4图片：</td>				                <td><input class="upinput" id="uphdp9" /></td>				                <td class="remark_td"><input type="button" value="上传" onclick="uploads('9')"/></td>			   				</tr>			   				<tr><td class="title_td" colspan="3" >注:请上传960*365大小的jpg,png,gif类型图片</td></tr>			           </table>	       			</div>	       		  </div>		       		<!-- 大幻灯片链接 -->	       			<?php 	       			$sql="select id,type,url,path,orders from trunimg where type=2 order by orders";	       			$result = mysql_query($sql);	       				       			?>	       		   <div class="layout" >	       			<div class="title">热门产品展示链接</div>	       			<div class="content">	       			<form id="bigur2_form" method="post" action="puset.php" >			           <table>			              <?php                               $jt = 1;			                  while($row = mysql_fetch_array($result))			                  	{			                  		echo "<tr><td class='title_td'>产品".$jt."链接：</td>";			                  		echo" <td><input name='bigur2".$row['orders']."' value=".$row['url']." /></td>";			                  		echo"</tr>";			                  					                  		$jt++;			                  	}			              ?>			              <tr>			              	 <td class="title_td"></td>			   				 <td><input type="submit" value="保存"  /></td>			   				 <td class="remark_td"><input name="hid" type="hidden" value="bigur2" /></td>			              </tr>			           	</table>			           </form>	       			</div>	       		  </div>		       				    </div>
	    
    	<div id="bottom"></div>	
    </div>




